<a href="index.php?p=ask" class="btn primary" style="padding: 5px 10px 5px 5px;"><span style="line-height:20px;vertical-align:top;"><img src="a4f.png"/> Ask for feedback</span></a>
<h4 style="margin:0;padding:0;">Fedback requests</h4>
<div style="margin:5px 0 0 10px;">

    <?php
    $sql = "SELECT * FROM `asks` WHERE `ignored` = '0' AND `finished`='0' AND `foruid`='".$_SESSION['uid']."' ORDER BY `id` DESC";
    $query = $db->query($sql) or die(mysql_error());
    require_once 'classes/ask.class.php';
    require_once 'classes/work.class.php';
    require_once 'classes/user.class.php';
    require_once 'classes/category.class.php';
    while ($asks = mysql_fetch_object($query)) {
        $aid = $asks->id;
        $ask = new Ask($aid);
        $work = new Work($ask->getWorkId());
        $asking_user = new User($work->getUserId());
        ?>
        <div id="click_uid<?php echo $aid; ?>" class="asking">
            <p style="margin:0;"><a href="#"><?php echo $asking_user->getName() . " " . $asking_user->getSurname(); ?></a> requests feedback</p>
            <p style="margin:-3px 0 0 0;font-size:10px;">Job category: <?php
            
            $category = new Category($work->getCategoryId()); 
            echo $category->getName();
            ?></p>
            <div id="uid<?php echo $aid; ?>" style="display:none;">
                <script type="text/javascript">
                    $(function() {
                        var austDay = new Date();
                        <?php
                        $datep = date("Y-m-d", strtotime(date("Y-m-d", strtotime(date("Y-m-d", strtotime($work->getDate())))) . " +2 week"));
                        	$time = explode(" ", $datep);
                            $date = explode("-", $time[0]);
 
                        ?>
                        
                   
                        austDay = new Date(<?php echo $date[0];?>,<?php echo $date[1]-1;?>,<?php echo $date[2];?>,0,0,0);
                        $('.defaultCountdown').countdown({until: austDay});
                        $('#year').text(austDay.getFullYear());
                    });
                    $('#click_uid<?php echo $aid; ?>').click(function() {
                        var bool = 0;
                        $('#uid<?php echo $aid; ?>').toggle();
                    });
                </script>
                <div class="defaultCountdown" style="margin:0 0 5px 0;"></div>
                <div class="center">
                    <br/>
                    <a href="index.php?p=gfeedback&askid=<?php echo $aid;?>" class="button green"><span>Give feedback</span></a>
                <a href="ignoreask.php?id=<?php echo $aid;?>" class="button red"><span>Reject</span></a>
                </div>
            </div>
           
        </div>
        <?php
    }
    ?>
</div>


